<?php

namespace app\admin\controller;

use app\admin\model\Config;
use app\BaseController;
use app\lib\FileDB;
use app\lib\ZFileDB;
use think\Request;

class Setting extends BaseController
{

    public function getConfig(Request $request)
    {
        $bgUrl = FileDB::table('config')->where('key', 'bg_Url')->find(1)['value'];
        $bgUrl = str_replace('\\', "/", $bgUrl);
        return show(config('status.success'), 'success', [
            'bg_url' => $bgUrl
        ]);
    }

    public function updateSetting(Request $request)
    {
        FileDB::table('config')->where('key', 'bg_url')->update([
            'value' => $request->post('bg_url'),
        ]);
        return show(config('status.success'), 'success');
    }
}
